#include "regwin.h"
#include "ui_regwin.h"
#include <QFile>
regwin::regwin(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::regwin)
{
    ui->setupUi(this);
    connect(ui->regbtn,&QPushButton::clicked,this,&regwin::reg);
}

void regwin::reg()
{
    if(ui->pwInput->text()==ui->comfirmpwInput->text())
    {
        QFile file("pw.t");
        file.open(QIODevice::Append | QIODevice::Text);
        QTextStream a(&file);
        a<<ui->nameInput->text()<<'\n'<<ui->pwInput->text()<<'\n';
        file.close();
        this->hide();
        return;
    }
    ui->errorlabel->setText("密码输入错误");
}

regwin::~regwin()
{
    delete ui;
}
